package com.bilibili.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bilibili.entity.CommenResult;
import com.bilibili.service.CommentService;
import com.bilibili.service.impl.CommentServiceImpl;


@WebServlet("/oneComment.do")
public class OneCommentServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("application/json;charset=utf-8");
		CommentService cs = new CommentServiceImpl();
		String videoId = request.getParameter("e");
		int vId = Integer.parseInt(videoId);
		int resultCount = cs.selectCountByVId(vId);
		CommenResult result = new CommenResult();
    	result.setData(resultCount);
    	response.getWriter().write(result.toJOSNString());
	}
}
